using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter23
{
	/// <summary>
	/// Example10: An Accelerating Positive Charge
	/// A positive point charge q of mass m is released from 
	/// rest in a uniform electric field E directed along
	/// the x axis. Describe its motion.
	/// x_f = q E / (2m) * t^2
	/// v_f = q E / m * t
	/// K = q E x_f	
	/// </summary>
	public class Example10
	{
		public Example10()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass m = new L.Mass();
			m.kg = 10.0;
			L.ElectricCharge q = new L.ElectricCharge();
			q.C = 3.0;
			L.ElectricField E = new L.ElectricField();
			E.X = 5.0;
			L.Force[] F = new L.Force[1];
			F[0] = new L.Force();
			F[0].X = q.C*E.X;
			L.TotalForce TF = new L.TotalForce(F);
			L.Acceleration a = new L.Acceleration(m,TF);
			
			L.Time t = new L.Time();
			t.s = 23.0;

			L.Velocity v = new L.Velocity();
			v.X = a.X*t.s;

			L.Position x = new L.Position();
			x.X = 0.5*a.X*t.s*t.s;
			
			result+=Convert.ToString(v.X)+"\r\n";	
			result+=Convert.ToString(x.X)+"\r\n";
		}
	}
}
